#!/usr/bin/env python
# coding: utf-8

# 给定一些单词，有些词可能会重复。对于每个单词，输出它出现的次数。输出顺序应与单词出现的输入顺序一致。   
# 
# 输入：`word_list = ['bcdef','abcdefg','bcde','bcdef']`
# 
# 预期输出:  `2 1 1 2 `
# 

# In[2]:


n = 4
word_list = ['bcdef','abcdefg','bcde','bcdef']
word_dict = {}
for i in range(n):
    word = word_list[i]
    word_dict[word] = word_dict.get(word, 0) + 1
for word in word_list:
    print(word_dict[word], end=" ")

